import { request } from "./request"

// 请求商品详情
export function DetailRequest(iid) {
    return request({
        url: "detail",
        params: {
            iid
        }
    })
}

//请求推荐的图片的数据
export const reqRecommends = () => request('/recommend')

export class Goods {
    constructor(itemInfo, columns, services) {
        this.title = itemInfo.title;
        this.desc = itemInfo.desc;
        this.newPrice = itemInfo.price;
        this.oldPrice = itemInfo.oldPrice;
        this.discount = itemInfo.discountDesc;
        this.columns = columns;
        this.services = services;
        this.realPrice = itemInfo.lowNowPrice;
    }
}

//整合参数数据
export class Params {
    constructor(info, rule) {
        this.info = info;
        this.rule = rule;
    }
}

//整合评论的数据
export function CommentInfo(commentInfo) {
    this.user = commentInfo.user
    this.content = commentInfo.content
    this.created = commentInfo.created
    this.style = commentInfo.style
    this.images = commentInfo.images
}